package com.moss.cloud.common.core.model.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserLoginDTO implements Serializable {
    public static final String DEFAULT_USERNAME = "system";
    public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
    /**
     * 主键
     */
    private Long id;
    /**
     * 登录账号
     */
    private String accountNumber;
    /**
     * 登录设备
     */
    private String equipment;
    /**
     * 登录IP地址
     */
    private String remoteIp;
    /**
     * 登录时间
     */
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = DATE_FORMAT)
    private LocalDateTime loginTime;
    /**
     * 登录状态
     */
    private String loginStatus;
    /**
     * 用户ID
     */
    private Long userId;
    /**
     * 租户ID
     */
    private Long tenantId;
}
